<?php
	require("frmCookie.php");
?>
<html>
	<head>
    	<?php
		require("frmHeader.php");
		?>
	</head>
	<body>
    	<table cellpadding="0" cellspacing="0" align="center" class="tablaPrincipal">
        	<tr>
            	<td align="center">
                	<?php
					require("frmSession.php"); 
					
					//Redirecciona a SINPERMISOS.PHP en caso de no tener permisos
					
					if (!(in_array(10004, $_SESSION[permisos])))
					{
					?>
						<script language="JavaScript" type="text/javascript">
							window.top.location.href = "sinPermisos.php"
						</script>
					<?php
					}
					$titulo = "Tipos De Parte X Marca";
					
					?>
                </td>
            </tr>
            <tr>
            	<td align="center">
                	<?php
					require("frmTitulo.php");
					?>
                </td>
            </tr>
            <tr>
            	<td height="20">&nbsp;
                	
                </td>
            </tr>
            <tr>
            	<td align="center">
                	<table cellpadding="0" cellspacing="0" align="center" class="menuPrincipal">
                    	<tr>
                        	<td>
								<?php
                                require("frmMenu.php");
                                ?>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
            	<td height="20">&nbsp;
                	
                </td>
            </tr>
            <tr>
                <td align="center">
                	<table cellpadding="0" cellspacing="0" align="center" class="tituloPantalla">
                    	<tr>
                        	<td align="center">
                            	<p class="texto" align="left"><?php echo $titulo; ?></p>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
             <tr>
            	<td height="20">&nbsp;
                	
                </td>
            </tr>
            <tr>
                <td align="center">
                	<table cellpadding="0" cellspacing="0" align="center" class="estadoPantalla">
                    	<tr>
                        	<td align="center">
                            	<p class="texto" align="left"><?php echo $mensaje; ?></p>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
             <tr>
            	<td height="20">&nbsp;
                	
                </td>
            </tr>
            <tr>
				<?php
                $sql = "select * from marcas order by nombre";
                $result = readSQL($sql);
				$cantidadDeMarcas = count($result);
				$anchoColumna = 100/($cantidadDeMarcas+1);
				$anchoColumna = round($anchoColumna,0);
                ?>
                <td align="center">
                	<table cellpadding="0" cellspacing="0" align="center" class="contenedorPrincipal">
                    	<tr>
                        	<td align>
                                <table border="1" width="100%">
                                    <tr>
                                    	<td width="<?php echo $anchoColumna.'%';?>">
                                        </td>
										<?php
                                        foreach($result as $value)
                                        {
                                            echo "<td width='$anchoColumna.%' align='center'>";
												echo $value['nombre'];
											echo "</td>";
                                        }
                                        ?>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
	</body>
</html>